<?php

use think\facade\Route;

const DS = 'public/';

Route::miss(function () {
    $appRequest = request()->pathinfo();
    if ($appRequest === null) {
        $appName = '';
    } else {
        $appRequest = str_replace('//', '/', $appRequest);
        $appName = explode('/', $appRequest)[0] ?? '';
    }

    switch (strtolower($appName)) {
        case 'pc':
            return view(app()->getRootPath() . 'public' . DS . 'index.html');
        case 'admin':
            return view(app()->getRootPath() . 'admin' . DS . 'index.html');
        default:
//            dd(app()->getRootPath()  . DS . '404.html');
            return view(app()->getRootPath()  . DS . '404.html');
    }
});
